require(['./config'],() =>{
	require(['template','header','footer','service'],(template) =>{
		class List{
			constructor() {
			    this.getLeft()
				this.getLists()
				this.getList()
				this.lastIndex = 0
				this.index = 0
			}
		getLists(){				
			for(let i=0;i<$('.main-right-span').length;i++){
				$('.main-right-span').eq(i).on('mouseenter', () =>{
					this.lastIndex = this.index
					this.index = i
					$('.main-right-span').eq(this.index).children('.main-right-ziji').show()
					$('.main-right-span').eq(this.lastIndex).children('.main-right-ziji').hide()
					
				})
			}
		}
		getList(){
			console.log(1)
			for(let i=0;i<$('.main-right-ul li').length;i++){
				$('.main-right-ul li').eq(i).on('click', () =>{
					this.lastIndex = this.index
					this.index = i
					console.log(1)
					console.log($('.main-right-ul li')	)
					$('.main-right-ul li').eq(this.index).addClass('whiter')
					$('.main-right-ul li a').eq(this.index).addClass('fon')
					$('.main-right-ul li').eq(this.lastIndex).removeClass('whiter')
					$('.main-right-ul li a').eq(this.lastIndex).removeClass('fon')
					
				})
		}
		}
		getLeft(){
			
			$.get('http://www.xiongmaoyouxuan.com/api/search?word=%E6%89%8B%E5%8A%9E&start=0&sort=0&couponOnly=0&minPrice=0&maxPrice=99999',resp =>{
				if(resp.code === 200){
					let {list} = resp.data
					let pub = list
					list = pub.slice(0,3)
					let list2 = pub.slice(3,10)
					let list3 = pub.slice(10,25)
					let list4 = pub.slice(25,30)
					let list5 = pub.slice(30,36)
					$("#tabList").html(template('tabListTemplate',{ list }))
					$("#tabList2").html(template('tabListTemplate2',{ list2 }))
					$("#tabList3").html(template('tabListTemplate3',{ list3 }))
					$("#tabList4").html(template('tabListTemplate4',{ list4 }))
					$("#tabList5").html(template('tabListTemplate5',{ list5 }))
				}
			})
		}
		
		}
		new List()
	})
})
